// let li = "";
// data1.map(function(v, i) {
//     li += `<li class="hlw_li ">
//                                    <div class="hlw_box text-center">
//                                        <!--图片-->
//                                        <div class="hlw_boxImg mb-10">
//                                            <a href="../html/goods.html?shopName=beautyData#${v.goodsid}">
//                                                <img src="${v.goodsurls.nowurl}" alt="" class="w100">
//                                            </a>
//                                        </div>
//                                        <!--切换-->
//                                        <div class="hlw_toggle mt-10 mb-10">
//                                            <ul class="df">`;
//     v.goodsurls.picsurl.forEach(function(v1, i1) {
//         li += `<li class="hlw_toggle_img mr-5">
//                                       <a href="javascript:void(0)">
//                                        <img src="${v1}" alt="" class="w100">
//                                       </a>
//                                 </li>`
//     });
//     li += `

//                                            </ul>
//                                        </div>
//                                        <!--价格-->
//                                        <div class="hlw_num df justify-sb mb-10">
//                                           <p> ￥<span class="hlw_price">${v.goodszprice}</span></p>
//                                            <p>已售 <span class="hlw_num">${v.sales}</span>件</p>
//                                        </div>
//                                        <!--描述-->
//                                        <div class="hlw_depict mb-10">
//                                            <a href="../html/goods.html?shopName=beautyData#${v.goodsid}" class="fc-0000" title="${v.goodstitle}">
//                                               ${v.goodstitle}
//                                            </a>
//                                        </div>
//                                        <div class="hlw_smallShop df mb-10">
//                                            <i class="hs_shop">${v.shopname}</i>
//                                            <span class="iconfont">&#xe608;</span>
//                                        </div>
//                                        <div class="hlw_gn ">
//                                            <div class="">
//                                                <div class="hlw_line df">
//                                                    <a href="javascript:void(0)" style="color: black" class="hlw_contrast"><span class="hgz_choose mr-5 sp-contrast" data-choose="${v.goodsid}"></span>对比</a>
//                                                    <a href="javascript:void(0)" style="color: black">
//                                                        <span class="iconfont">&#xe627;</span>收藏
//                                                    </a>
//                                                    <a href="javascript:void(0)" style="color: red"><span class="iconfont fc-red">&#xe63f;</span>加入购物车</a>
//                                                </div>
//                                            </div>
//                                        </div>
//                                    </div>
//                                 </li>`

// });
$(function() {


    var s = window.localStorage; //获取所有本地存储记录
    console.log(s);

    var ert = [];
    var ert2 = []
    var arrll = [];
    // console.log(ert);
    for (var key in s) { //获取 本地存储 的 键
        if (key.includes('sy')) { //判断键是有带有空格字符   (防止其他键混入)

            console.log(ert2.push(key.slice(2)));
        }

    }
    console.log(ert2);
    ert2.forEach(function(v, i) { //根据err 数组遍出访问过的id 

            for (var k in data) { //遍历data数据的所有键
                data[k].forEach(function(value, i1) { //每个键的所有值
                    if (ert2[i] == value.goodsid) {
                        arrll.push(value);
                    }


                });
            }
        })
        // console.log(arrll);
    let li2 = "";
    arrll.forEach(function(jg, i) {
        li2 += `
    <li class="hlw_li ">
        <div class="hlw_box text-center">
            <!--图片-->
            <div class="hlw_boxImg mb-10">
                <a href="../html/goods.html?shopName=beautyData#${jg.goodsid}">
                    <img src="${jg.goodsurls.nowurl}" alt="" class="w100">
                </a>
            </div>
            <!--切换-->
            <div class="hlw_toggle mt-10 mb-10">
                <ul class="df">`;
        jg.goodsurls.picsurl.forEach(function(v1, i1) {
            li2 += `<li class="hlw_toggle_img mr-5">
                                                  <a href="javascript:void(0)">
                                                   <img src="${v1}" alt="" class="w100">
                                                  </a>
                                            </li>`
        });
        li2 += `
    </ul>
                                       </div>
                                       <!--价格-->
                                       <div class="hlw_num df justify-sb mb-10">
                                          <p> ￥<span class="hlw_price">${jg.goodszprice}</span></p>
                                           <p>已售 <span class="hlw_num">${jg.sales}</span>件</p>
                                       </div>
                                       <!--描述-->
                                       <div class="hlw_depict mb-10">
                                           <a href="../html/goods.html?shopName=beautyData#${jg.goodsid}" class="fc-0000" title="${jg.goodstitle}">
                                              ${jg.goodstitle}
                                           </a>
                                       </div>
                                       <div class="hlw_smallShop df mb-10">
                                           <i class="hs_shop">${jg.shopname}</i>
                                           <span class="iconfont">&#xe608;</span>
                                       </div>
                                       <div class="hlw_gn ">
                                           <div class="">
                                               <div class="hlw_line df">
                                                   <a href="javascript:void(0)" style="color: black" class="hlw_contrast"><span class="hgz_choose mr-5 sp-contrast" data-choose="${jg.goodsid}"></span>对比</a>
                                                   <a href="javascript:void(0)" style="color: black">
                                                       <span class="iconfont">&#xe627;</span>收藏
                                                   </a>
                                                   <a href="javascript:void(0)" style="color: red"><span class="iconfont fc-red">&#xe63f;</span>加入购物车</a>
                                               </div>
                                           </div>
                                       </div>
                                   </div>
                                </li>`
            // $('.liji').append(li2);
    })
    $('.lljl').append(li2)
        // console.log(li2);
    $('.hlw_toggle_img').hover(function() {
        var imght = $(this).children().children()[0].src;

        $(this).parent().parent().prev().children().children()[0].src = imght;
    })
    $('.ll-div>div').click(function() {

        for (var i = 0; i <= arrll.length; i++) {
            console.log(ert[i]);
            localStorage.removeItem('sy' + ert2[i])
        }
        $('.lljl').html(' ')
    })
});